//热门关键字管理.js
function upWords(id){
	 layer.confirm("确定上架此关键字？",function(){
			layer.closeAll('dialog');
			var layer_load_window = layer.load(2); 
			 $.ajax({
					url : path+"/hot_key_words/update_by_id",
					cache : false,
					type : 'post',
					dataType : 'text',
					data:{'id':id,
						'status':2},
					error : function() {
						layer.alert("操作失败！");
			       },
					success : function(data) {
					    if(data == "success"){
						    layer.msg('上架成功!',{icon:1,time:1000},function(){
						    	$("#search_form").submit();
						    });
					   }else if(data == "error"){
						layer.alert("操作失败！");
					   } else {
						   layer.alert(data);
					   }
					},
					complete: function(XMLHttpRequest, textStatus) {
						layer.close(layer_load_window);
					}
				  });	
	 });
}
function downWords(id){
	 layer.confirm("确定下架此关键字？",function(){
			layer.closeAll('dialog');
	var layer_load_window = layer.load(2); 
	 $.ajax({
			url : path+"/hot_key_words/update_by_id",
			cache : false,
			type : 'post',
			dataType : 'text',
			data:{'id':id,
				'status':1},
			error : function() {
				layer.alert("操作失败！");
	       },
			success : function(data) {
			    if(data == "success"){
				    layer.msg('下架成功!',{icon:1,time:1000},function(){
				    	$("#search_form").submit();
				    });
			   }else if(data == "error"){
					layer.alert("操作失败！");
			   } else {
				   layer.alert(data);
			   }
			},
			complete: function(XMLHttpRequest, textStatus) {
				layer.close(layer_load_window);
			}
		  });	
	 });
}
function deleteWords(id){
	 layer.confirm("确定删除此关键字？",function(){
			layer.closeAll('dialog');
			var layer_load_window = layer.load(2); 
			 $.ajax({
					url : path+"/hot_key_words/delete_by_id",
					cache : false,
					type : 'post',
					dataType : 'text',
					data:{'id':id},
					error : function() {
						layer.alert("操作失败！");
			       },
					success : function(data) {
					    if(data == "success"){
						    layer.msg('删除成功!',{icon:1,time:1000},function(){
						    	$("#search_form").submit();
						    });
					   }else if(data == "error"){
							layer.alert("操作失败！");
					   } else {
						   layer.alert(data);
					   }
					},
					complete: function(XMLHttpRequest, textStatus) {
						layer.close(layer_load_window);
					}
				  });	
		 });
}
function addWords(){
		var url=path+"/hot_key_words/to_add_hot_key_words";
		var index = layer.open({
			   type: 2,
			   title: "添加热门关键字",
			   scrollbar: false,
			   content: url,
			   area: ['400px', '400px']
		 });
}